<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/jquery-3.6.0.js"></script>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
        background-color: black;
    }

    div {
        width: 650px;
        height: 420px;
        border: 1px solid white;
        margin: 100px auto;
    }

    li {
        list-style: none;
        cursor: pointer;
        float: left;
        margin: 6px 0;
        padding: 5px 0 0 12px;
    }

    /* .img{
        opacity: 0.4;
    }

    .img_two {
        opacity: 1;
    } */
    /* ul li img:hover{
        opacity: 1;
    } */
    .img_other{
        opacity: 0.4;
    }
</style>

<body>
    <div>
        <ul class="nav">
            <li><img src="images/01.jpg"></li>
            <li><img src="images/02.jpg"></li>
            <li><img src="images/03.jpg"></li>
            <li><img src="images/04.jpg"></li>
            <li><img src="images/05.jpg"></li>
            <li><img src="images/06.jpg"></li>
        </ul>
    </div>
    <script>
        //hover方法
        $('li').hover(function (){
            $(this).siblings().toggleClass('img_other');
        })
    </script>
</body>

</html>